import Vue from "vue";
import VueRouter from "vue-router";

import Home from "../views/Home.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "Home",
    component: Home
  },
  {
    path: "/hot",
    name: "Hot",
    component: () => import("../views/Hot")
  },
  {
    path: "/part",
    name: "Part",
    component: () => import("../views/Part")
  },
  {
    path: "/about",
    name: "About",
    // 组件异步加载 实现懒加载
    component: () => import("../views/About.vue")
  }
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes
});

export default router;
